package top.kaoshanji.q1ch06d.main;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import top.kaoshanji.q1ch06d.config.ProjectConfig;
import top.kaoshanji.q1ch06d.model.Comment;
import top.kaoshanji.q1ch06d.services.CommentService;

/**
 * 代码清单-q1ch06d-01：Main类的定义
 * @author kaoshanji
 * ^_^
 * create time 2025/4/29 10:50
 */
public class Main {

    public static void main(String[] args) {

        var context = new AnnotationConfigApplicationContext(ProjectConfig.class);

        var service = context.getBean(CommentService.class);

        Comment comment = new Comment();
        comment.setText("Demo comment");
        comment.setAuthor("Natasha");

        service.publishComment(comment);
        service.deleteComment(comment); // 被ToLog注解标记了的方法
        service.editComment(comment);


    }

}
